#include <stdio.h>
#include <unistd.h>
#include <libgen.h>
#include <string.h>

void get_exe_path(char *path, int path_size) {
  readlink("/proc/self/exe", path, path_size);
}

void get_exe_dir(char *path, int path_size) {
  char *buf;
  readlink("/proc/self/exe", path, path_size);
  buf = dirname(strdup(path));
  memset(path, 32, strlen(path));
  for (int i = 0; i < strlen(buf); i++)
    path[i] = buf[i];
}
